#!/usr/bin/env python
# -*- coding: gb2312 -*-

"""

"""

from email.Header import Header
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
import smtplib, datetime

#
msg = MIMEMultipart()

#
att = MIMEText(open('test.doc', 'rb').read(), 'base64', 'gb2312')
att["Content-Type"] = 'application/octet-stream'
att["Content-Disposition"] = 'attachment; filename="test.doc"'
msg.attach(att)

#
msg['to'] = 'huys2003@qq.com'
msg['from'] = 'huys2003@qq.com'
msg['subject'] = Header('xxxxx (' + str(datetime.date.today()) + ')','gb2312')

#
server = smtplib.SMTP('smtp.qq.com')
server.login('huys2003','fox090200***')
error=server.sendmail(msg['from'], msg['to'],msg.as_string())
server.close
print error

